home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-1.iso / Files / System 7 / S / SimpleInfo.sit / SimpleInfo / Source Code ƒ / SimpleInfo.bas next >
Encoding:
BASIC Source File  |  1995-04-02  |  8.0 KB  |  288 lines  |  [TEXT/ZBAS]

  1. '       SimpleInfo...
  2. '       a nice clean application to give you all the simplest information
  3. '       about your macintosh computer...
  4. '       Copyright 1995 pdgm (Damon Law). All rights reserved. No patents
  5. '       pending…
  6.  
  7. '       I wrote this because I bought a new monitor and I needed to know
  8. '       what the hell the pixel dimensions were… This is oficially version 2.0
  9. '       because I wrote another version (1.0 - der!) to do the same thing
  10. '       once I figured out I could get screen dimensions without having to
  11. '       dig through literature! So here's the code…
  12.  
  13. '       The source code and auxillary files are provided for humour value, but
  14. '       if you decide to yank even the slightest bit - you should consider
  15. '       giving me credit. If you _learn_ something please tell me.
  16.  
  17. '       I can be reached at DamonLaw@aol.com
  18.  
  19. '       All orginization techniques are purely coincidental.
  20.  
  21.  
  22.  
  23. COMPILE 0,_dimmedVarsOnly
  24. RESOURCES "SimpleInfo.res","APPLwhat"
  25.  
  26.  
  27.  
  28. '       constants________________________________________________pdgm
  29.  
  30. _mainWnd        =1
  31. _aboutWnd       = 2
  32.  
  33.  
  34.  
  35. '       globals__________________________________________________pdgm
  36.  
  37. DIM gProgramEnds
  38. DIM mainGraphic&,mainGraphicRect.8
  39. DIM screenWidth,screenHeight,systemVers,maxColors,currentDepth,cpu,mach
  40. DIM cpuRect.8,machRect.8,sysVersRect.8,scrnSizeRect.8,scrnDpthRect.8
  41. DIM cpu$,mach$,sysVers$,scrnSize$,scrnDpth$
  42. END GLOBALS
  43.  
  44.  
  45.  
  46. '       conjuction-junction, what's your…
  47. '       functions________________________________________________pdgm
  48.  
  49.  
  50. LOCAL FN doDialog
  51.   DIM evnt,id
  52.   
  53.   evnt = DIALOG(0)
  54.   id   = DIALOG(evnt)
  55.   SELECT evnt
  56.     CASE _wndClick                                'Window clicked.
  57.       WINDOW id                                   'Activate clicked Window.
  58.     CASE _wndClose                                'Window Wants to be closed.
  59.       WINDOW CLOSE id                             'Otherwise close window.
  60.     CASE ELSE
  61.   END SELECT
  62. END FN
  63.  
  64.  
  65. LOCAL FN doAbout
  66.   DIM swc,about&,about$
  67.   
  68.   LONG IF WINDOW(-_aboutWnd)=_false
  69.     swc=(SYSTEM(_scrnWidth)/2)-1
  70.     WINDOW CLOSE _aboutWnd
  71.     WINDOW -_aboutWnd,"About SimpleInfo…",(swc-149,103)-(swc+150,218),_docNoGrow
  72.     PICTURE FIELD -7,"pdgm logo (Icon)",(6,6)-(37,37),_statNoFramed,_cropPict
  73.     
  74.     about&=0
  75.     PICTURE ON
  76.     COLOR _zBlack                                 'just in case the pen got switched
  77.     PEN ,,,,3
  78.     PLOT 42,5 TO 42,110
  79.     TEXT _sysfont,12
  80.     CALL MOVETO (46,14) : PRINT "SimpleInfo"
  81.     TEXT _geneva,9
  82.     CALL MOVETO (48,50)  :PRINT "Damon Law"
  83.     CALL MOVETO (48,65)  :PRINT "Thank you:"
  84.     CALL MOVETO (48,80)  :PRINT "Dallas / Portland / Seattle"
  85.     CALL MOVETO (48,105) :PRINT "© MCMXCV (1995) pdgm";
  86.     CALL MOVETO (230,105):PRINT "Version 2.0";
  87.     PICTURE OFF, about&
  88.     DEFSTR LONG
  89.     about$="&"+MKI$(about&)
  90.     PICTURE FIELD -8, about$, (0,0)-(300,115), _statNoFramed+_statKeepBg,_cropPict
  91.     WINDOW _aboutWnd
  92.   XELSE
  93.     WINDOW _aboutWnd
  94.   END IF
  95.   
  96. END FN
  97.  
  98.  
  99. LOCAL FN closeAllWindows
  100.   
  101.   '     This is one of my fovorite pieces of code EVER!
  102.   '     “I made this!”
  103.   
  104.   DO
  105.     WINDOW CLOSE WINDOW(_activeWnd)
  106.   UNTIL WINDOW(_activeWnd)=0
  107.   
  108. END FN
  109.  
  110.  
  111. LOCAL FN doMenu
  112.   DIM whichMenu,whatItem                          'This is minimalistic…
  113.   
  114.   whichMenu=MENU(0)
  115.   whatItem=MENU(1)
  116.   
  117.   SELECT CASE whichMenu
  118.     CASE 1000                                     'FILE MENU
  119.       SELECT CASE whatItem
  120.           
  121.         CASE 1                                    'Close 
  122.           LONG IF WINDOW(-_activeWnd)=_aboutWnd
  123.             WINDOW CLOSE _aboutWnd
  124.           XELSE                                   'Close all windows & split!
  125.             FN closeAllWindows
  126.             CALL INITCURSOR
  127.             END                                   'Get the hell out!
  128.           END IF
  129.           
  130.         CASE 2                                    'Quit (regardless…)
  131.           FN closeAllWindows
  132.           CALL INITCURSOR
  133.           END                                     'wah-hoo!
  134.           
  135.         CASE ELSE
  136.       END SELECT
  137.     CASE 127                                      'APPLE MENU
  138.       IF whatItem=1 THEN FN doAbout
  139.     CASE ELSE
  140.   END SELECT
  141.   
  142.   MENU
  143.   
  144. END FN
  145.  
  146.  
  147. LOCAL FN initialize
  148.   
  149.   '     Ooh! I'm pushing the limits of quickdraw here!
  150.   
  151.   CALL SETRECT (mainGraphicRect,0,0,299,210)
  152.   CALL SETRECT (cpuRect,46,48,263,61)
  153.   CALL SETRECT (machRect,46,83,263,96)
  154.   CALL SETRECT (sysVersRect,46,118,263,131)
  155.   CALL SETRECT (scrnSizeRect,46,152,263,165)
  156.   CALL SETRECT (scrnDpthRect,46,186,263,199)
  157.   
  158.   '     egad! I thought it couldn't be done in 7 lines of code!
  159.   
  160.   cpu = SYSTEM(_cpuType)
  161.   mach = SYSTEM(_machType)
  162.   systemVers = SYSTEM(_sysVers)
  163.   screenWidth = SYSTEM(_scrnWidth)
  164.   screenHeight = SYSTEM(_scrnHeight)
  165.   maxColors = SYSTEM(_maxColors)
  166.   currentDepth = SYSTEM(_crntDepth)
  167.   
  168. END FN
  169.  
  170.  
  171. LOCAL FN checkItOut
  172.   
  173.   '     Yeah I should have done this with constants so that
  174.   '     Hajimoto could READ it if it ever got to Japan…
  175.   
  176.   SELECT CASE cpu
  177.     CASE _env68000
  178.       cpu$ = "68000 processor"
  179.     CASE _env68010
  180.       cpu$ = "68010 processor"
  181.     CASE _env68020
  182.       cpu$ = "68020 processor"
  183.     CASE _env68030
  184.       cpu$ = "68030 processor"
  185.     CASE _env68040
  186.       cpu$ = "68040 processor"
  187.     CASE ELSE
  188.       cpu$ = "? (unknown processor)"
  189.   END SELECT
  190.   
  191.   SELECT CASE mach
  192.     CASE _envMachUnknown
  193.       mach$ = "? (unknown Macintosh model)"
  194.     CASE _envXL
  195.       mach$ = "Macintosh XL"
  196.     CASE _envMac
  197.       mach$ = "Macintosh (Original)"
  198.     CASE _env512KE
  199.       mach$ = "Macintosh 512k enhanced"
  200.     CASE _envMacPlus
  201.       mach$ = "Macintosh Plus"
  202.     CASE _envSE
  203.       mach$ = "Macintosh SE"
  204.     CASE _envMacII
  205.       mach$ = "Macintosh II"
  206.     CASE _envMacIIx
  207.       mach$ = "Macintosh IIx"
  208.     CASE _envMacIIcx
  209.       mach$ = "Macintosh IIcx"
  210.     CASE _envSE30
  211.       mach$ = "Macintosh SE/30"
  212.     CASE _envPortable
  213.       mach$ = "Macintosh Portable"
  214.     CASE _envMacIIci
  215.       mach$ = "Macintosh IIci"
  216.     CASE _envMacIIfx
  217.       mach$ = "Macintosh IIfx (wicked fast)"
  218.     CASE ELSE
  219.       mach$ = "? (unknown Macintosh model)"
  220.   END SELECT
  221.   
  222.   sysVers$ = "System software version"+LEFT$(STR$(systemVers),2)+"."
  223.   sysVers$ = sysVers$ + MID$(STR$(systemVers),3,1)+"." + RIGHT$(STR$(systemVers),1)
  224.   
  225.   scrnSize$ = RIGHT$(STR$(screenWidth),LEN(STR$(screenWidth))-1)
  226.   scrnSize$ = scrnSize$ + " pixels by" + STR$(screenHeight) + " pixels"
  227.   
  228.   SELECT CASE maxColors
  229.     CASE 1
  230.       scrnDpth$ = "1 bit (Blue & White)"
  231.     CASE 2
  232.       scrnDpth$ = "up to 2 bit (4 colors)"
  233.     CASE 4
  234.       scrnDpth$ = "up to 4 bit (16 colors)"
  235.     CASE 8
  236.       scrnDpth$ = "up to 8 bit (256 colors)"
  237.     CASE 24
  238.       scrnDpth$ = "up to 24 bit (32,000 colors)"
  239.     CASE 32
  240.       scrnDpth$ = "up to 32 bit (16 million colors)"
  241.     CASE ELSE
  242.       scrnDpth$ = "? (unknown bit-depth/color limit)"
  243.   END SELECT
  244.   
  245. END FN
  246.  
  247.  
  248. LOCAL FN setItUp
  249.   
  250.   '     Pretty self explanitory…
  251.   '     Turned the AUTOCLIP off to try and increase speed.
  252.   
  253.   WINDOW -_mainWnd,,@mainGraphicRect,_docNoGrow+_noGoAway
  254.   AUTOCLIP = _false
  255.   PICTURE FIELD 1,"8bit",@mainGraphicRect,_statNoFramed+_statKeepBg,_cropPict
  256.   EDIT FIELD 2,cpu$,@cpuRect,_statFramed,_leftJust
  257.   EDIT FIELD 3,mach$,@machRect,_statFramed,_leftJust
  258.   EDIT FIELD 4,sysVers$,@sysVersRect,_statFramed,_leftJust
  259.   EDIT FIELD 5,scrnSize$,@scrnSizeRect,_statFramed,_leftJust
  260.   EDIT FIELD 6,scrnDpth$,@scrnDpthRect,_statFramed,_leftJust
  261.   WINDOW _mainWnd
  262.   
  263. END FN
  264.  
  265.  
  266.  
  267. '       start____________________________________________________pdgm
  268.  
  269. WINDOW OFF                                        'damn thing!
  270. BREAK OFF                                         'darned switches!!
  271. EDIT MENU -2                                      'kick the EDIT menu in…
  272. ON MENU FN doMenu                                 'power that stuff up…
  273. ON DIALOG FN doDialog                             'fuel this sucker…
  274.  
  275. FN initialize                                     'load the variables
  276. FN checkItOut                                     'scan the system
  277. FN setItUp                                        'show gathered info
  278.  
  279.  
  280.  
  281. '       main_____________________________________________________pdgm
  282.  
  283. DO
  284.   ' eternal loop
  285.   HANDLEEVENTS
  286. UNTIL gProgramEnds
  287.  
  288.